
'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const MarkdonwSchema = new mongoose.Schema({
    name: { type: String, index: true, required: true },
    describe: { type: String },
    coverUrl: { type: String },
    content: { type: String, required: true },
    typeTags: { type: Array, required: true },
    extra: { type: mongoose.Schema.Types.Mixed },
    createdAt: { type: Date, default: Date.now },
    author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
  });
  return mongoose.model('Markdown', MarkdonwSchema);
};
